home *** CD-ROM | disk | FTP | other *** search
- on startMovie
- global stateDB, restDB, fullstateDEX, stateDEX, cuisineDEX, specialtyDEX, abbrevstateDEX, restnameDEX
- set DBResult to DBOpenSession()
- if DBResult < 0 then
- alert("Error opening FileFlex session.")
- quit()
- end if
- set stateDBF to the moviePath & "STATES.DBF"
- set restDBF to the moviePath & "RESTDB.DBF"
- set stateDB to DBUse(stateDBF)
- checkFail(stateDB, "Error opening states data file.")
- set restDB to DBUse(restDBF)
- checkFail(restDB, "Error opening restaurants data file.")
- set fullstate to the moviePath & "FULLSTAT.NDX"
- set abbrevstate to the moviePath & "ABBREVST.NDX"
- set state to the moviePath & "BYSTATE.NDX"
- set cuisine to the moviePath & "BYCUIS.NDX"
- set specialty to the moviePath & "BYSPEC.NDX"
- set restname to the moviePath & "RESTNAME.NDX"
- set DBResult to DBSelect(stateDB)
- checkFail(DBResult, "Error selecting state data file.")
- set fullstateDEX to DBUseIndex(fullstate)
- checkFail(fullstateDEX, "Error opening full state index file.")
- set abbrevstateDEX to DBUseIndex(abbrevstate)
- checkFail(abbrevstateDEX, "Error opening state abbreviation index file.")
- set DBResult to DBSelect(restDB)
- checkFail(DBResult, "Error selecting restaurant data file.")
- set stateDEX to DBUseIndex(state)
- checkFail(stateDEX, "Error opening state index file.")
- set cuisineDEX to DBUseIndex(cuisine)
- checkFail(cuisineDEX, "Error opening cuisine index file.")
- set specialtyDEX to DBUseIndex(specialty)
- checkFail(specialtyDEX, "Error opening specialty index file.")
- set restnameDEX to DBUseIndex(restname)
- checkFail(restnameDEX, "Error openint restaurant name index file.")
- end
-
- on stopMovie
- global stateDB, restDB, fullstateDEX, abbrevstateDEX, stateDEX, cuisineDEX, specialtyDEX, restnameDEX
- set DBResult to DBSelect(stateDB)
- checkFail(DBResult, "Error selecting state data file.")
- set DBResult to DBCloseIndex(fullstateDEX)
- checkFail(DBResult, "Error closing full state index file.")
- set DBResult to DBCloseIndex(abbrevstateDEX)
- checkFail(DBResult, "Error closing state abbreviation index file.")
- set DBResult to DBSelect(restDB)
- checkFail(DBResult, "Error selecting restaurant index file.")
- set DBResult to DBCloseIndex(stateDEX)
- checkFail(DBResult, "Error closing state index file.")
- set DBResult to DBCloseIndex(cuisineDEX)
- checkFail(DBResult, "Error closing cuisine index file.")
- set DBResult to DBCloseIndex(specialtyDEX)
- checkFail(DBResult, "Error closing specialty index file.")
- set DBResult to DBCloseIndex(restnameDEX)
- checkFail(DBResult, "Error closing restaurant name index file.")
- set DBResult to DBClose(stateDB)
- checkFail(DBResult, "Error closing states data file.")
- set DBResult to DBClose(restDB)
- checkFail(DBResult, "Error closing restaurants data file.")
- set DBResult to DBCloseSession()
- if DBResult < 0 then
- alert("Error closing FileFlex session.")
- quit()
- end if
- end
-
- on checkFail resultCode, alertNote
- if resultCode < 0 then
- alert(alertNote & " [" & string(resultCode) & "]")
- set DBResult to DBCloseSession()
- if DBResult < 0 then
- alert("Error closing FileFlex session.")
- quit()
- end if
- quit()
- end if
- end
-